<?php
    $product_name = $_POST['product_name'];
    $page = $_POST['page'];
    $page = $page - 1;
    $page = $page * 20;
    include_once('connect.php');
    $db2 = new database("SELECT pro_id, pro_name, pro_price_sell, pro_price_buy, pro_quantity 
                        FROM  product 
                        WHERE  pro_name LIKE '%".$product_name."%'");
                        
    $num_row = $db2->num_row();
    $arr['num_row'] = $num_row;
    $arr['page_number'] = ceil($num_row/20);
    $db = new database("SELECT pro_id, pro_name, pro_price_sell, pro_price_buy, pro_quantity 
                        FROM  product 
                        WHERE  pro_name LIKE '%".$product_name."%'
                        LIMIT ".$page.",20");
    $arr['pro_info'] = $db->render();
    
    echo(json_encode($arr));
?>